//
// Created by weslywang on 2020/4/25.
//

#ifndef LEETCODE2020_COMMON_H
#define LEETCODE2020_COMMON_H

#include <stack>
#include <queue>
#include <math.h>
#include <algorithm>
#include <string>
#include <map>
#include <set>
#include <vector>
#include <iomanip>
#include <iostream>
#include <sstream>
#include<sys/time.h>
#include "BitSet.h"
#include <unordered_set>
#include <unordered_map>

using namespace std;

struct TreeNode {
    int val;
    TreeNode *left;
    TreeNode *right;

    TreeNode(int x) : val(x), left(NULL), right(NULL) {}
};

struct Node {
    int val;
    Node *left;
    Node *right;
    Node *next;
    vector<Node *> neighbors;

    Node() {
        val = 0;
        neighbors = vector<Node *>();
    }

    Node(int _val) {
        val = _val;
        left = NULL;
        right = NULL;
        next = NULL;
        neighbors = vector<Node *>();
    }

    Node(int _val, vector<Node *> _neighbors) {
        val = _val;
        neighbors = _neighbors;
    }
};

class Common {
public:
    int defaultEmptyTreeNodeVal = INT_MAX;// 默认的空树节点的值
    TreeNode *makeTree(vector<int> num);//构造二叉树
    Node *treeNodeToNode(TreeNode *);//TreeNode转换成Node
    vector<vector<int>> loadData();

    vector<vector<string>> loadStringData();

    vector<string> loadStringData2();

    vector<vector<char>> loadCharData();

    void printVector(vector<vector<char>> &list);

    void printVector(vector<vector<string>> &list);

    void printVector(vector<vector<int>> &list);

    int getTreeHeight(TreeNode *tree);//计算树的高度
    void printTree(TreeNode *tree);

    void makeTreeFull(TreeNode *tree);// 把树的左右为空的节点都填充默认的空节点
};


#endif //LEETCODE2020_COMMON_H
